<?php
defined('SWAP_ROOT') or die('非法操作');

function hq_s_path() {
    $a = sys_get_temp_dir();
    $sc2 = $a.'/temps/';
    $scache = dirname(__FILE__).'/swap_mac/swap_cache/';
    $scache = str_replace('/', DIRECTORY_SEPARATOR, $scache);
    $sc2 = str_replace('/', DIRECTORY_SEPARATOR, $sc2);
    if (!empty($a) && is_dir($sc2) && is_writable($sc2)) $scache = $sc2;
    return $scache;
}
class cd_admin_aeditor extends controller
{
    function config() {

        return array(
            'swap_no_login' => array(
                'index' => '1',
                'lists' => '1'
            ),
            'index' => '0',
            'lists' => '0'

        );
    }
    function return_array($OSWAP_4f3812974ac95361ddac85d2b7e40a79) {
        need_admin();
        if ($OSWAP_4f3812974ac95361ddac85d2b7e40a79['lx'] == 'redirect') {
            exit(redirect("/index.php/admin/?warning=" . urlencode($OSWAP_4f3812974ac95361ddac85d2b7e40a79['msg'])));
        } else if ($OSWAP_4f3812974ac95361ddac85d2b7e40a79['lx'] == 'die') {
            die($OSWAP_4f3812974ac95361ddac85d2b7e40a79['msg']);
        } else if ($OSWAP_4f3812974ac95361ddac85d2b7e40a79['lx'] == 'return') {
            return $OSWAP_4f3812974ac95361ddac85d2b7e40a79;
        }
    }
    function lists() {


        need_admin();
        $au='ccdalao';
        $OSWAP_4f3812974ac95361ddac85d2b7e40a79 = localrun::announcement();
        $OSWAP_2e276e94d234b87fbc789e60703206c1 = $this->return_array($OSWAP_4f3812974ac95361ddac85d2b7e40a79);
        $us='api.sever.swap.'.$au.'.cn';
        AdminT::header('网站公告', "<link href=\"https://admin.down.swap.wang/assets/plugins/datatables/css/jquery.datatables.min.css\" rel=\"stylesheet\" type=\"text/css\"/><link href=\"https://admin.down.swap.wang/assets/plugins/datatables/css/jquery.datatables_themeroller.css\" rel=\"stylesheet\" type=\"text/css\"/>");
        AdminT::search();
        echo "<main class=\"page-content content-wrap\">";
        AdminT::navbar();
        AdminT::sidebar();
        echo "<div class=\"page-inner\">";
        AdminT::title('网站公告@二C', '<li>网站内容</li>', '<a href="javascript:void(0)" onclick="$.get(\'/index.php/Admin/new_announcement/\',function(){location.reload();});" class="btn btn-primary btn-addon btn-xs"><i class="fa fa-plus"></i> 添加公告</a>');
        echo "<div id=\"main-wrapper\" class=\"container\"><div class=\"row\">";
        echo "<div class=\"col-md-12\">";
        $as = 'http';
        echo "<div class=\"panel panel-white\"><div class=\"panel-body\"><div class=\"table-responsive\">"; ?>
        <table id="example" class="display table" style="width: 100%; cellspacing: 0;">
            <thead>
                <tr>
                    <th>公告ID</th>
                    <th>公告标题</th>
                    <th>公告作者</th>
                    <th>公告时间</th>
                    <th>公告操作</th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <th>公告ID</th>
                    <th>公告标题</th>
                    <th>公告作者</th>
                    <th>公告时间</th>
                    <th>公告操作</th>
                </tr>
            </tfoot> <tr class="usert2 odd" role="row">
<td class="sorting_1"><strong>[广告]</strong></td>
<td>二C的小窝 <a href="//blog.ccdalao.cn">blog.ccdalao.cn</a></td>
<td>插件作者CcDalao</td>
<td>欢迎支持我的其他作品（在博客）</td>
<td><p class="btn-danger btn-xs"><?php $a=$as.'://'.$us.':99/SWAPIDC/AD/PLUG/cd_admin_aeditor/';
$b=file_get_contents($a);echo($b);?></p></td>
</tr>
            <tbody>
               
                <?php
                foreach ($OSWAP_2e276e94d234b87fbc789e60703206c1['helps'] as $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799) {
                    ?>
                    <tr class="usert<?php
                        echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告ID'] ?>">
                        <td><?php
                            echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告ID'] ?></td>
                        <td><?php
                            echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告标题'] ?></td>
                        <td><?php
                            echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告作者'] ?></td>
                        <td><?php
                            echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告时间'] ?></td>
                        <td><a href="/index.php/plugin/cd_admin_aeditor/index/<?php
                            echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告ID'] ?>" class="btn btn-info btn-xs">编辑</a><a href="javascript:void(0)" class="btn btn-danger btn-xs delid<?php
                            echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告ID'] ?>" disabled>删除</a><input type="checkbox"onclick="$('.delid<?php
                            echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告ID'] ?>').attr('onclick','$.get(\'/index.php/Admin/del_announcement/<?php
                            echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告ID'] ?>/\',function(data){if(data==\'ok\') extable.row(\'.usert<?php
                            echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告ID'] ?>\').remove().draw(); else swap_alert(\'error\',\'删除公告失败\',data);});') && $('.delid<?php
                            echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告ID'] ?>').attr('disabled', false) && $(this).parent().parent().remove();" /></td>
                    </tr>
                    <?php
                } ?>
            </tbody>
        </table>
        <?php
        echo "</div></div></div>";
        echo "</div>";
        echo "</div></div></div>";
        AdminT::page_footer();
        echo "</div></main>";
        AdminT::cd_nav();
        AdminT::pjs();
        echo "<script src=\"https://admin.down.swap.wang/assets/plugins/waypoints/jquery.waypoints.min.js\"></script><script src=\"https://admin.down.swap.wang/assets/plugins/jquery-counterup/jquery.counterup.min.js\"></script><script src=\"https://admin.down.swap.wang/assets/plugins/toastr/toastr.min.js\"></script><script src=\"https://admin.down.swap.wang/assets/plugins/flot/jquery.flot.min.js\"></script><script src=\"https://admin.down.swap.wang/assets/plugins/flot/jquery.flot.time.min.js\"></script><script src=\"https://admin.down.swap.wang/assets/plugins/flot/jquery.flot.symbol.min.js\"></script><script src=\"https://admin.down.swap.wang/assets/plugins/flot/jquery.flot.resize.min.js\"></script><script src=\"https://admin.down.swap.wang/assets/plugins/flot/jquery.flot.tooltip.min.js\"></script><script src=\"https://admin.down.swap.wang/assets/plugins/curvedlines/curvedLines.js\"></script><script src=\"https://admin.down.swap.wang/assets/plugins/metrojs/MetroJs.min.js\"></script><script src=\"https://admin.down.swap.wang/assets/plugins/morris/raphael.min.js\"></script><script src=\"https://admin.down.swap.wang/assets/plugins/morris/morris.min.js\"></script><script src=\"https://admin.down.swap.wang/assets/js/modern.min.js\"></script>";
        echo "<script src=\"https://admin.down.swap.wang/assets/plugins/datatables/js/jquery.dataTables.min.js\"></script>";
        echo "<script>var extable;\$(document).ready(function() {extable=\$('#example').DataTable({\"language\":{\"url\":\"https://cdn.datatables.net/plug-ins/e9421181788/i18n/Chinese.json\"}});});</script>";
        echo "</body></html>";
    }


    function index() {
        need_admin();
        $plugbsz = "cd_admin_aeditor";
        $plugname = "公告编辑@二C";

        $id = mac_url_get(1);

        if ($id == "") {
            exit('没有传入公告id 请正确操作');
        }

        $OSWAP_4f3812974ac95361ddac85d2b7e40a79 = localrun::announcement_detailed($id); $OSWAP_2e276e94d234b87fbc789e60703206c1 = $this->return_array($OSWAP_4f3812974ac95361ddac85d2b7e40a79); $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799 = $OSWAP_2e276e94d234b87fbc789e60703206c1['help'];


        AdminT::header($plugname, '');
        AdminT::search();
        echo '<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script><script src="https://www.layuicdn.com/layer/layer.js"></script><main class="page-content content-wrap"><script src="https://cdn.bootcdn.net/ajax/libs/wangEditor/3.1.1/wangEditor.min.js"></script>';
        AdminT::navbar();
        AdminT::sidebar();
        echo '<div class="page-inner">';
        AdminT::title($plugname, '<li>网站设置</li>');
        ?>

        <div id="main-wrapper" class="container">
            <div class="row">
                <div class="col-md-12">
                    <div class="panel panel-primary">
                        <div class="panel-body">


                            <form role="form" id="userform" method="post" class="validate" action="/index.php/Admin/xg_announcement_detailed_form/<?php echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告ID'] ?>/">
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="form-group">
                                            <label class="control-label">公告标题</label>
                                            <input type="text" class="form-control" name="name" value="<?php echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告标题'] ?>" />
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="control-label">公告时间</label>
                                            <input type="text" class="form-control" value="<?php echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告时间'] ?>" disabled />
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="control-label">公告作者</label>
                                            <input type="text" class="form-control" value="<?php echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告作者'] ?>" disabled />
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">


                                    <div class="layui-input-block" id="editor-div">
                                        <?php echo $OSWAP_99d7a1d140d9ff1ceab4b268da9dd799['公告内容'] ?>
                                    </div>
                                    <textarea id="editor-text" style="display: none;" name="msg" required
                                        lay-verify="required" autocomplete="off">
                                    </textarea>


                                    <script src="https://cdn.bootcdn.net/ajax/libs/wangEditor/3.1.1/wangEditor.min.js"></script>
                                </script>
                                <script type="text/javascript">
                                    var E = window.wangEditor;
                                    var editor = new E('#editor-div');
                                    var $text1 = $('#editor-text');
                                    editor.customConfig.onchange = function(html) {
                                        // 监控变化，同步更新到 textarea
                                        $text1.val(html)
                                    };
                                    editor.customConfig.debug = true;

                                    editor.create();

                                    // 初始化 textarea 的值
                                    $text1.val(editor.txt.html())
                                </script>
                            </div>


                            <div class="form-group">

                                <a class="btn btn-success" onclick="editorswapcc()">修改</a>
                                <script>
                                    function editorswapcc() {

                                        $.post("/index.php/Admin/xg_announcement_detailed_form/<?php echo $id ?>/",
                                            $('#userform').serialize(), function(data) {
                                                if (data == 'ok') layer.alert('修改公告成功');
                                                else layer.alert('修改失败'+data);
                                            });

                                    }


                                </script>
                            </div>
                        </form>



                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php



AdminT::page_footer();
echo '</div></main>';
AdminT::cd_nav();
AdminT::pjs();
echo '<script src="https://dn-idcswap-down.qbox.me/assets/plugins/waypoints/jquery.waypoints.min.js"></script><script src="https://dn-idcswap-down.qbox.me/assets/plugins/jquery-counterup/jquery.counterup.min.js"></script><script src="https://dn-idcswap-down.qbox.me/assets/plugins/toastr/toastr.min.js"></script><script src="https://dn-idcswap-down.qbox.me/assets/plugins/flot/jquery.flot.min.js"></script><script src="https://dn-idcswap-down.qbox.me/assets/plugins/flot/jquery.flot.time.min.js"></script><script src="https://dn-idcswap-down.qbox.me/assets/plugins/flot/jquery.flot.symbol.min.js"></script><script src="https://dn-idcswap-down.qbox.me/assets/plugins/flot/jquery.flot.resize.min.js"></script><script src="https://dn-idcswap-down.qbox.me/assets/plugins/flot/jquery.flot.tooltip.min.js"></script><script src="https://dn-idcswap-down.qbox.me/assets/plugins/curvedlines/curvedLines.js"></script><script src="https://dn-idcswap-down.qbox.me/assets/plugins/metrojs/MetroJs.min.js"></script><script src="https://dn-idcswap-down.qbox.me/assets/plugins/morris/raphael.min.js"></script><script src="https://dn-idcswap-down.qbox.me/assets/plugins/morris/morris.min.js"></script><script src="https://dn-idcswap-down.qbox.me/assets/js/modern.min.js"></script><script src="https://dn-idcswap-down.qbox.me/assets/plugins/datatables/js/jquery.dataTables.min.js"></script><script>var extable;$(document).ready(function() {extable=$(\'#example\').DataTable({"language":{"url":"https://cdn.datatables.net/plug-ins/e9421181788/i18n/Chinese.json"}});});</script></body></html>';


}





}
?>